package com.sen.common.widget.form;

import com.sen.common.widget.Attributes;
import com.sen.common.widget.Component;

/**
 * @author sen
 */
public class TextArea extends Component {

	private String rows;
	private String cols;

	public TextArea() {
		this(null);
	}
	
	public TextArea(String name) {
		this(null, name);
	}
	
	public TextArea(String id, String name) {
		super("textarea");
		this.id(id).name(name);
	}

	public TextArea value(String value) {
		this.add(new Content(value));
		return this;
	}

	public TextArea rows(int rows) {
		this.rows = String.valueOf(rows);
		return this;
	}

	public TextArea cols(int cols) {
		this.cols = String.valueOf(cols);
		return this;
	}

	@Override
	protected String specialAttributes() {
		return Attributes.attrIfNonblank("rows", rows)
				+ Attributes.attrIfNonblank("cols", cols);
	}
}
